<template>
  <div class="pagination">
    <el-pagination @current-change="handleCurrentChange" layout="prev, pager, next, jumper" :total="total">
    </el-pagination>
  </div>
</template>

<script>
import api from "../../api";
export default {
  data() {
    return {
      total: 0,
    };
  },
  mounted() {
    api.total().then((res) => {
      if (res.status === 200) {
        if(res.data.code === 200) {
          this.total = res.data.result[0]["count(*)"];
        }
      }
    });
  },
  methods: {
    handleCurrentChange(val) {
      this.$bus.$emit('onPage',val)
    },
  },
};
</script>

<style scoped>
.pagination {
  margin-top: 30px;
}
</style>